package cn.com.idmy.cloud;

import cn.com.idmy.base.model.Page;
import com.alibaba.fastjson2.filter.NameFilter;

import static cn.com.idmy.base.config.DefaultConfig.pageRowsKey;

public class GlobalNameFilter implements NameFilter {
    @Override
    public String process(Object obj, String name, Object value) {
        if (!pageRowsKey.equals("rows")) {
            if (obj instanceof Page<?>) {
                return name.equals("rows") ? pageRowsKey : name;
            }
        }
        return name;
    }
}